<% cache("user-profile-comments-#{@user.updated_at}-#{@user.id}-#{@comments.first&.id}-#{@comments.size}", :expires_in => 1.day) do %>
  <style>
    .index-comments header {
      color: <%= HexComparer.new([user_colors(@user)[:bg], user_colors(@user)[:text]]).brightness(0.88) %>
    }
  </style>
  <div class="index-comments">
    <% if @comments.any? %>
      <% if params[:view] == "comments" %>
      <div class="breadcrumb"><a href="<%= @user.path %>">View All Activity</a></div>
      <header>
        <% if @user.comments_count > 250 %>
          Last 250 Comments
        <% else %>
          All <%= @user.comments_count %> Comments
        <% end %>
      </header>
      <% else %>
        <header>
          Recent Comments
        </header>
      <% end %>
    <% end %>
    <% @comments.each do |comment| %>
      <% if comment.commentable.present? && comment.commentable.published && !comment.deleted %>
        <a href="<%= comment.path %>">
          <div class="single-comment <%= "strong-comment" if comment.ancestry == nil%>">
            <span class="comment-title">re: <%= comment.commentable.title %></span>
            <span class="comment-date"><%= comment.readable_publish_date %></span>
            <div class="comment-preview"><%= truncate(strip_tags(comment.processed_html), length:64).html_safe %></div>
          </div>
        </a>
      <% end %>
    <% end %>
    <% if params[:view] != "comments" &&  @user.comments_count > 250 %>
      <div class="breadcrumb"><a href="<%= @user.path %>/comments">Last 250 Comments</a></div>
    <% elsif params[:view] != "comments" &&  @user.comments_count > 8 %>
      <div class="breadcrumb"><a href="<%= @user.path %>/comments">View All <%= @user.comments_count %> Comments</a></div>
    <% end %>
  </div>
<% end %>